<extend name="Public/common" />
<tagLib name="Editor"/>
<block name="body">
<div class="page">
  <div class="fixed-bar">
    <div class="item-title">
      <h3>商户管理</h3>
      <ul class="tab-base">
        	<li><a href="{:U('index')}"><span>列表</span></a></li>
	        <li><a href="{:U('add')}"><span>新增</span></a></li>
	        <li><a href="JavaScript:void(0);" class="current"><span>编辑</span></a></li>
      </ul>
    </div>
  </div>
  <div class="fixed-empty"></div>
  <form id="form1" method="post" enctype="multipart/form-data" name="form1">
    <input type="hidden" name="store_id" value="{$info['store_id']}" />
    <table class="table tb-type2">
      <tbody>
        <tr class="noborder">
          <td colspan="2" class="required"><label class="validation" for="store_name">商户名称:</label></td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform"><input type="text" value="{$info['store_name']}" name="store_name" id="store_name" class="txt"></td>
          <td class="vatop tips">商户的名称</td>
        </tr>
        <tr>
          <td colspan="2" class="required"><label class="validation" for="store_username">商户联系人:</label></td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform"><input type="text" value="{$info['store_username']}" name="store_username" id="store_username" class="txt"></td>
          <td class="vatop tips">商户的店长，或联系人</td>
        </tr> 
        <tr>
          <td colspan="2" class="required"><label class="validation" for="store_telephone">联系方式:</label></td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform"><input type="text" value="{$info['store_telephone']}" name="store_telephone" id="store_telephone" class="txt"></td>
          <td class="vatop tips">联系方式，可以是多个电话。多个用,号隔开。</td>
        </tr>

        <tr>
          <td colspan="2" class="required"><label for="thumb" class="validation">LOGO:</label></td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform"><span class="type-file-show"><img class="show_image" src="__IMG__/preview.png">
            <div class="type-file-preview"><img src="{$info['store_logo']}"></div></span>
            <span class="type-file-box"><input type='text' name='textfield' id='textfield1' class='type-file-text' /><input type='button' name='button' id='button1' value='' class='type-file-button' />
            <input name="store_logo" type="file" class="type-file-file" id="store_logo" size="30" hidefocus="true" nc_type="change_store_logo">
            </span></td>
          <td class="vatop tips"><span class="vatop rowform">系统支持的图片格式为:gif,jpg,jpeg,png，商户logo</span></td>
        </tr>

        <tr>
          <td colspan="2" class="required"><label for="store_slogan" class="validation">slogan:</label></td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform"><input type="text" value="{$info['store_slogan']}" name="store_slogan" id="store_slogan" class="txt"></td>
          <td class="vatop tips">商户的slogan</td>
        </tr>

        <tr>
          <td colspan="2" class="required"><label for="store_address">商户详细地址:</label></td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform"><input type="text" value="{$info['store_address']}" name="store_address" id="store_address" class="txt"></td>
          <td class="vatop tips">商户的详细地址</td>
        </tr>
        <tr>
          <td colspan="2" class="required"><label for="store_address">快递取货地址:</label></td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform"><input type="text" value="{$info['deliver_address']}" name="deliver_address" id="deliver_address" class="txt"></td>
          <td class="vatop tips">商户的详细地址</td>
        </tr>
        <tr>
          <td colspan="2" class="required"><label>
            <label for="status">商户状态:</label>
            </label></td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform onoff">
			<label for="status1" class="cb-enable <eq name='info.status' value='1'>selected</eq>" ><span>开启</span></label>
            <label for="status2" class="cb-disable <eq name='info.status' value='2'>selected</eq>" ><span>关闭</span></label>
            <input id="status1" name="status" <eq name='info.status' value='1'>checked="checked"</eq> onclick="$('#tr_store_close_info').hide();" value="1" type="radio">
            <input id="status2" name="status" <eq name='info.status' value='2'>checked="checked"</eq> onclick="$('#tr_store_close_info').show();" value="2" type="radio">
          </td>
          <td class="vatop tips"></td>
        </tr>
      </tbody>
      <tbody id="tr_store_close_info">
        <tr >
          <td colspan="2" class="required"><label for="remark">关闭原因:</label></td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform"><textarea name="remark" rows="6" class="tarea" id="store_close_info">{$info['remark']}</textarea></td>
          <td class="vatop tips"></td>
        </tr>
      </tbody>

      <tfoot>
        <tr class="tfoot">
          <td colspan="15" ><a href="JavaScript:void(0);" class="btn" id="submit"><span>提交</span></a></td>
        </tr>
      </tfoot>
    </table>
  </form>
</div>
  <script type="text/javascript" src="__JS__/fileupload/jquery.iframe-transport.js" charset="utf-8"></script>
  <script type="text/javascript" src="__JS__/fileupload/jquery.ui.widget.js" charset="utf-8"></script>
  <script type="text/javascript" src="__JS__/fileupload/jquery.fileupload.js" charset="utf-8"></script>
  <script type="text/javascript">
$(document).ready(function(){
	if({$info['status']} == 1){
		$('#tr_store_close_info').hide();
	}
	
	$('#form1').validate({
        errorPlacement: function(error, element){
			error.appendTo(element.parent().parent().prev().find('td:first'));
        },
        rules : {
        	store_name : {
                required : true
            },
            store_username : {
                required : true
            },
            store_telephone : {
                required : true
            }
        },
        messages : {
        	store_name : {
                required : "商户名称必须填写"
            },
            store_username : {
                required : "商户联系人必须填写"
            },
            store_telephone : {
                required : "商户联系方式必须填写"
            }
        }
    });
    $("#store_logo").change(function() {
        $("#textfield1").val($(this).val());
    });
    $('input[class="type-file-file"]').change(function() {
        var filepatd = $(this).val();
        var extStart = filepatd.lastIndexOf(".");
        var ext = filepatd.substring(extStart, filepatd.lengtd).toUpperCase();
        if (ext != ".PNG" && ext != ".GIF" && ext != ".JPG" && ext != ".JPEG") {
            alert("图片限于png,gif,jpeg,jpg格式");
            $(this).attr('value', '');
            return false;
        }
    });
	$("#submit").click(function() {
		if ($("#form1").valid()) {
			$("#form1").submit();
		}
	});
});
</script>
</block>